package org.example;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.RestOptions;
import org.apache.flink.table.api.EnvironmentSettings;
import org.apache.flink.table.api.TableEnvironment;

public class FlinkBatchInsetUpdateDelete3 {
    public static void main(String[] args) throws Exception {
        EnvironmentSettings settings = EnvironmentSettings.newInstance().inBatchMode().build();
        TableEnvironment tableEnv = TableEnvironment.create(settings);

        // 创建Paimon catalog
        tableEnv.executeSql("CREATE CATALOG paimon WITH (\n" +
                "    'type' = 'paimon',\n" +
                "    'warehouse' = 'file:///tmp/paimon'\n" +
                ");");

        tableEnv.executeSql("-- 删除一条数据\n" +
                "DELETE FROM `paimon`.`default`.`user_behavior_with_pk` WHERE dt='2025-01-13';");

        tableEnv.executeSql("select * from `paimon`.`default`.`user_behavior_with_pk`;").print();
    }
}